package ex.other;

import ex.datastream.functions.sourceFunction.SourceFuncByItem;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class MyStreamingSourceMain {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env=StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<SourceFuncByItem.Item> text =env.addSource(new SourceFuncByItem()).setParallelism(1);

        DataStream<SourceFuncByItem.Item> item=text.map((
                MapFunction<SourceFuncByItem.Item, SourceFuncByItem.Item>) value ->value);
        item.print().setParallelism(1);
        String jobName="user defined streaming source";
        env.execute(jobName);
    }
}
